// 引入字体图标
require('../../assets/public/fonts/iconfont.css')

// 渲染到页面
function renderTabbar(pathname) {
    // 获取当前地址
    console.log('location.pathname :>> ', location.pathname);
    let arr = [
        {
            path: './home.html',
            title: '首页',
            icon: 'icon-shouye',
        },
        {
            path: './course.html',
            title: '运动',
            icon: 'icon-24gl-heartPulse',
        },
        {
            path: './circle.html',
            title: '圈子',
            icon: 'icon-quanzi',
        },
        {
            path: './mine.html',
            title: '我的',
            icon: 'icon-yonghu',
        },
    ]
    let html = `
    ${arr.map((v) => {
        return `
        <div class="nav df fdc jcc ">
          <a href="${v.path}" class="iconfont ${v.icon} ${v.path === `./${pathname}.html` && 'active'}"></a>
          <a href="${v.path}" class="navText ${v.path === `./${pathname}.html` && 'active'}">${v.title}</a>
        </div>
        `
    }).join('')}
    `

    // 创建一个div
    let div = document.createElement('footer')
    // 设置div的class
    div.className = 'tabbar df jcsa fn'
    div.innerHTML = html
    // 添加在body最后
    document.body.appendChild(div)
}
// 导出
module.exports = renderTabbar
// render()